package com.kotiln.lgc.rxjava.obser;

import java.util.List;

/**
 * @author $
 * @fileName Observeable
 * @date2021/3/17 17:05
 * @describe TODO
 * @desc 被观察者的实现类
 */
public class ObserveableImpl implements Observable {

    //存储观察者的集合
    private List<Observer> observers;

    @Override
    public void registerObserver(Observer observer) {
        observers.add(observer);
    }

    @Override
    public void removerObserver(Observer observer) {
        observers.remove(observer);
    }

    @Override
    public void changeObservers() {
        for(Observer observer:observers){
            observer.change("发生改变了...");
        }
    }
}
